package com.twopai.login;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.twopai.appbase.routerpath.RoutePath;
import com.twopai.framelibrary.entity.RunShopDetailEntity;
import com.twopai.framelibrary.http.BaseObjectBean;
import com.twopai.framelibrary.mvp.BaseStatusActivity;
import com.twopai.login.contact.LoginContact;
import com.twopai.login.presenter.LoginPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;

@Route(group = RoutePath.login, path = RoutePath.ROUTER_LOGIN)
public class LoginActivity extends BaseStatusActivity<LoginPresenter> implements LoginContact.View {

    @Autowired
    int itemId;

    @Autowired
    String title;

    @BindView(R2.id.txt_msg)
    TextView txtMsg;
    @BindView(R2.id.toolBarCenterText)
    TextView toolBarCenterText;

    private String TAG = "LoginActivity";
    @Override
    protected int setToolBarId() {
        return R.id.toolBarWholeLinear;
    }
    @Override
    public int getLayoutId() {
        return R.layout.activity_login;
    }

    @Override
    public void iniTitle() {

    }

    @Override
    public void initView(@Nullable Bundle savedInstanceState) {
        toolBarCenterText.setText("登录");
    }

    @Override
    public void initData() {
        getIntentData();
    }

    private void getIntentData() {
        Log.e(TAG, "-->itemId=" + itemId + ",title=" + title);
        Intent intent = getIntent();
        if (intent != null) {
            title = intent.getStringExtra("title");
            itemId = intent.getIntExtra("itemId", -1);
            txtMsg.setText("-->" + title);
            Log.e(TAG, "-->itemId=" + itemId + ",title=" + title);
        }
    }

    @Override
    public void newsInfoSuccess(BaseObjectBean<RunShopDetailEntity> bean) {

    }

    @Override
    public void newsInfoError(Throwable e) {

    }

}
